﻿using System;

namespace Mvc.XForms.Actions {
	public class ActionAction : IAction {
		public XFormAction Action {
			get { return XFormAction.Action; }
		}
		public XFormEvent Event { get; set; }
		public string If { get; set; }
		public string JSFunction { get; set; }

		// Not currently implemented
		public string While { get; set; }

		public object ToJson() {
			var json = new {
				type = (int)Action,
				ev = Event.ToScriptName(),
				func = JSFunction
			};
			return json;
		}
	}
}